<!DOCTYPE html>
<html lang="pt-br"
      xmlns="http://www.w3.org/1999/xhtml"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:p="http://primefaces.org/ui"
      xmlns:c="http://java.sun.com/jsp/jstl/core">
    <h:head>
        <title>Menu Esquerdo</title>
    </h:head>
    <h:body>
        <h:form id="menuEsquerdo">
            <p:growl id="messages" /> 
            <p:menu style="width:95%" >
				<br />
	                <c:if test="#{1==1}">
	           			<p:submenu label="#{msg.menuEsquerdoGeral}">  	                	
	                		<p:menuitem value="#{msg.menuEsquerdoPrincipal}" action="/index.xhtml?faces-redirect=true" icon="ui-icon-home" /> 
	                	</p:submenu>
					</c:if>
							
	                <c:if test="#{request.isUserInRole('Administrator')}">
	                	<p:submenu label="#{msg.menuEsquerdoManutencao}"> 
	                        <p:menuitem value="#{msg.menuEsquerdoLiga}" action="/resources/adm/entidades/liga/ligaLista.xhtml?faces-redirect=true" icon="ui-icon-flag"/>
	                        <p:menuitem value="#{msg.menuEsquerdoJogo}" action="/resources/adm/entidades/jogo/jogoLista.xhtml?faces-redirect=true" icon="ui-icon-calculator"/>
	                        <p:menuitem value="#{msg.menuEsquerdoJogador}" action="/resources/adm/entidades/jogador/jogadorLista.xhtml?faces-redirect=true" icon="ui-icon-person"/>
	                        <p:menuitem value="#{msg.menuEsquerdoPartida}" action="/resources/adm/entidades/partida/partidaLista.xhtml?faces-redirect=true" icon="ui-icon-star"/>
						</p:submenu>
					</c:if>

	                <c:if test="#{request.isUserInRole('Manager') or request.isUserInRole('Administrator')}">
		                <p:submenu label="#{msg.menuEsquerdoGerencia}"> 
	                        <p:menuitem value="Gerente" action="/resources/gerente/GerentePrincipal.xhtml?faces-redirect=true" icon="ui-icon-star"/>
						</p:submenu>
					</c:if>

	                <c:if test="#{request.isUserInRole('User') or request.isUserInRole('Administrator') or request.isUserInRole('Manager')}">
					        <p:submenu label="#{msg.menuEsquerdoRelatorio}">  
		                        <p:menuitem value="#{msg.menuEsquerdoLigas}" action="/resources/user/entidades/liga/liga.xhtml?faces-redirect=true" icon="ui-icon-script"/>
		                        <p:menuitem value="#{msg.menuEsquerdoJogos}" action="/resources/user/entidades/jogo/jogo.xhtml?faces-redirect=true" icon="ui-icon-script"/>
		                        <p:menuitem value="#{msg.menuEsquerdoJogadores}" action="/resources/user/entidades/jogador/jogador.xhtml?faces-redirect=true" icon="ui-icon-script"/>
		                        <p:menuitem value="#{msg.menuEsquerdoPartida}" action="/resources/user/entidades/partida/partida.xhtml?faces-redirect=true" icon="ui-icon-script"/>
					        </p:submenu>  
					</c:if>

                     <c:if test="#{request.getUserPrincipal() == null}">
                       <p:menuitem value="#{msg.menuEsquerdoConectar}" action="/index.xhtml?faces-redirect=true" icon="ui-icon-power" />
                    </c:if>

                    <c:if test="#{request.getUserPrincipal() != null}">
                    	<p:submenu label="#{msg.menuEsquerdoLogado}: #{loginController.username}">                   
                       		<p:menuitem value="#{msg.menuEsquerdoDesconectar}" action="#{loginController.logout}" icon="ui-icon-pause"/>
                       </p:submenu>
                    </c:if>
            </p:menu>
        </h:form>
    </h:body>
</html>
